home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1988 April / Ahoy_Magazine_88-04_1988_Double_L.d64 / Random Walk (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  477b  |  13 lines

  1. 1 rem =================================
  2. 2 rem    commodares problem #48-2 :
  3. 3 rem      random walk
  4. 4 rem    solution by
  5. 5 rem      judy groth
  6. 6 rem =================================
  7. 10 poke 53280,0:poke 53281,0:print"[147][154]";:sp=1024:sc=54272
  8. 20 cc(1)=2:m(1)=-40:cc(2)=6:m(2)=40:cc(3)=7:m(3)=-1:cc(4)=5:m(4)=1
  9. 30 a=int(rnd(1)*4)+1: uc=112+a: if a=4 then uc=107
  10. 40 s=sp+m(a):ifs<1024 or s>2023 then 30
  11. 50 poke sp,uc:pokesp+sc,cc(a):sp=sp+m(a):rem if peek(s)=32 then sp=sp+m(a)
  12. 60 poke sp,81:poke sp+sc,1:goto 30
  13.